UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f1QQyFmMftaaBs1ai+6StJ5bFmZrRMuMCUOcl5pO2D8=' 
WHERE 
  key_id = '487100f5db7561ef2d0bce35a010706c245f3875d11f763ed091c130faa0139d' 
  AND (
    token = 'f1QQyFmMftaaBs1ai+6StJ5bFmZrRMuMCUOcl5pO2D8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030