UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oUCHTmpeeGX9zD7KXkheQZI6x8tSIknDVTrxBiooyTk=' 
WHERE 
  key_id = '9a97ed52f9d09f137575785d8ec8dbf237c5947298bd85931b47d22abf01b89c' 
  AND (
    token = 'oUCHTmpeeGX9zD7KXkheQZI6x8tSIknDVTrxBiooyTk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041