UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9+HGdYxUwAMIb4KdNsQf7Cik4yn2xYU8nhBfYhusKiU=' 
WHERE 
  key_id = '04753a5aae14f5c38e85f4191983fd4727158829be79579c477360cc1c3c16ca' 
  AND (
    token = '9+HGdYxUwAMIb4KdNsQf7Cik4yn2xYU8nhBfYhusKiU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048