UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MkZn0b+5V6OAvqhg8HruhCCBuqokne21DAtWP7EhZpw=' 
WHERE 
  key_id = '25abb6393f8b10d4711dd1e4a3c412933b398327e97b93c48439ac85a5473231' 
  AND (
    token = 'MkZn0b+5V6OAvqhg8HruhCCBuqokne21DAtWP7EhZpw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035