UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oLF1SRjd9m6HZLP0bRovWc0PUMBSRHsZoLTeNipgmPU=' 
WHERE 
  key_id = '31a7ecc91d1bf050b69dba48427b0a923a6d5d162bca6f5e19d57d4a4a927f5b' 
  AND (
    token = 'oLF1SRjd9m6HZLP0bRovWc0PUMBSRHsZoLTeNipgmPU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033