UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'geJS6bBhJAR6uDhmOkXgzlZ6IQ+mpkJkfDqe68Ac6n0=' 
WHERE 
  key_id = '821015b6babcc14097bc12c7a80b6f7a897a1ea1bc863efaa62730d8316480b0' 
  AND (
    token = 'geJS6bBhJAR6uDhmOkXgzlZ6IQ+mpkJkfDqe68Ac6n0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046