UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N6OGIx1dgsVyamAfK03hPjdJH2S3frirDo5zZSPbmPc=' 
WHERE 
  key_id = '81e8da568d8ee1d6683b040d343ed81011776d72b7ba7e020c71104c6f5761ee' 
  AND (
    token = 'N6OGIx1dgsVyamAfK03hPjdJH2S3frirDo5zZSPbmPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037