UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4HF5XlFDgp1fK5VCm7ilrlPUFknt8Cs5UrKsLvwftHI=' 
WHERE 
  key_id = '8bac188d68dacb7be078552871c152772b2c37f83fbfdb1b1945168a0bde5dc7' 
  AND (
    token = '4HF5XlFDgp1fK5VCm7ilrlPUFknt8Cs5UrKsLvwftHI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045