UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XNfZyy7Vx30yAkVv6SGwdK+ygcLiGtvNqslc2daBMdA=' 
WHERE 
  key_id = 'f5d3dc2d90c40cff6e504680f5a9b870bdb915cf5caa44b74c88e63e7ad46309' 
  AND (
    token = 'XNfZyy7Vx30yAkVv6SGwdK+ygcLiGtvNqslc2daBMdA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033