UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sKPJcn1w7grEkrclqoKEXio/xm6yo28y7iMgoiRx8hs=' 
WHERE 
  key_id = '938cc93ed0bfad937925cad73d96dcf3ddd2fd89fc3236870271901e71ed2911' 
  AND (
    token = 'sKPJcn1w7grEkrclqoKEXio/xm6yo28y7iMgoiRx8hs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059