UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oaYE4tZ6SU5YHoDht3iBOy7EVv44tcEr49nBBV+tsFI=' 
WHERE 
  key_id = '105df33b70c5903c9c4e72f8f573d6a78288fdc524c3e073ac62250bef99948b' 
  AND (
    token = 'oaYE4tZ6SU5YHoDht3iBOy7EVv44tcEr49nBBV+tsFI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017