UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PzZg2pkTRH8dNgKpMeuGzn062X1TCt7xel82lSMyUJA=' 
WHERE 
  key_id = '4d7565880a487ef759d7c604575bd878372e3613e18abca78665b8ade0a3af09' 
  AND (
    token = 'PzZg2pkTRH8dNgKpMeuGzn062X1TCt7xel82lSMyUJA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030