UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RXDE+MuZc1B6YOaeisVQZOJf1AXSD7jgT+N388NyDOA=' 
WHERE 
  key_id = 'a76a5c77222e3033a3c0c33e1d022c3b9940607a0d119c2ae2d57e3788c69ff0' 
  AND (
    token = 'RXDE+MuZc1B6YOaeisVQZOJf1AXSD7jgT+N388NyDOA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036