UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GBS4/YYzI/dZf90mdRxVZnhSXdfoQVyeQV6vs1M33Hc=' 
WHERE 
  key_id = 'c12e587bebf5b93435a9eef7a6d6a6329d036d783a0d355001c066d05604a762' 
  AND (
    token = 'GBS4/YYzI/dZf90mdRxVZnhSXdfoQVyeQV6vs1M33Hc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034