UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VgpDp5AFRgpkqbgKkalmwAllCHF5MAYFQ2o+vLavWOU=' 
WHERE 
  key_id = '79ae42f074cca14c3e0b466fce72f0f3e56afe12f832b6cc673ee0c55e186326' 
  AND (
    token = 'VgpDp5AFRgpkqbgKkalmwAllCHF5MAYFQ2o+vLavWOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020