UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AW2wRR8jAtYmEEEoIpHwVpdL+2MlwHwFbCOA88GpW+c=' 
WHERE 
  key_id = '20702037f3ca1cc1823b900e533ab5db63448bfb6ccf35c2a26c8dc2d271af60' 
  AND (
    token = 'AW2wRR8jAtYmEEEoIpHwVpdL+2MlwHwFbCOA88GpW+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020