UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IqLffirLscUF/5uoNF8u93o2nq/+v+rA3tXc+E1Nc9Y=' 
WHERE 
  key_id = '1455156ce1002a2a7be0a006c72ab8a632d78c998af5b489c920d7b586218719' 
  AND (
    token = 'IqLffirLscUF/5uoNF8u93o2nq/+v+rA3tXc+E1Nc9Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035