UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vkeS3noQ+fJ9E8XIspCDbt9d4l+iFmyQ5/gSvfep2Ow=' 
WHERE 
  key_id = '4c325f128719c281e1cb759476488fbc9229e74eaed6126ba5876d8079a15191' 
  AND (
    token = 'vkeS3noQ+fJ9E8XIspCDbt9d4l+iFmyQ5/gSvfep2Ow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030