UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZjFKTVVutO6FAO3+bHNpdEFeTF6MZp6TZYa5DEmqoUk=' 
WHERE 
  key_id = 'ddfe097b08831a060ec1a45e2db8fe3d4947d139ab8cc80b6df2167bdef1b845' 
  AND (
    token = 'ZjFKTVVutO6FAO3+bHNpdEFeTF6MZp6TZYa5DEmqoUk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038