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

Query time 0.00053