UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WFgY4B6QhOzPXTTx4sknTo6jZmmRyXliZCruQqYu49A=' 
WHERE 
  key_id = 'f4ebd3852362be1c549c55dbf2fd8e0e674a179f16ebe0f43e3ffd9e2f4d8e8e' 
  AND (
    token = 'WFgY4B6QhOzPXTTx4sknTo6jZmmRyXliZCruQqYu49A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040