UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WsFrCNQgVicL9db+FUQMuY8hWxbWSrfb2wT4tqlgXcU=' 
WHERE 
  key_id = '7dfacd05c36530e8ded798d083d110078854af9981a62ee3c46ba2e61451e600' 
  AND (
    token = 'WsFrCNQgVicL9db+FUQMuY8hWxbWSrfb2wT4tqlgXcU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029