UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TT+w0/9HjujplZXkFbDWqaX0yaqJwD4DueosbEyn0f8=' 
WHERE 
  key_id = '974674cd030069affde1453f5c9a4c57b3ade1369b8cd1d305b10daeae42ea8e' 
  AND (
    token = 'TT+w0/9HjujplZXkFbDWqaX0yaqJwD4DueosbEyn0f8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034