UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ywBGeZNoDk71QDZGxbKBBF2mD6IbUGgd8emYjrs3MnA=' 
WHERE 
  key_id = '5e36395d41642b3316e30fe76f2edc1f174b3a37852a278707adae76c864f92c' 
  AND (
    token = 'ywBGeZNoDk71QDZGxbKBBF2mD6IbUGgd8emYjrs3MnA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048