UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CG0N6sDQq0Ce72Z+gwUM3vMZPV7VF6uUPcrMUFWIVqs=' 
WHERE 
  key_id = 'dbda5fc8647494cf9b50eb2934194ff8a800a34e483edc27b5a0a2a8841ae136' 
  AND (
    token = 'CG0N6sDQq0Ce72Z+gwUM3vMZPV7VF6uUPcrMUFWIVqs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038