UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a+G2VP9MkXV2EtbL+Yivj3QRcQ4Y3Qk68pAJuSv+NKQ=' 
WHERE 
  key_id = '916db5460ebc4864f6c93a2c234c6260f086523aa0f76a0f07976f2f109fe19a' 
  AND (
    token = 'a+G2VP9MkXV2EtbL+Yivj3QRcQ4Y3Qk68pAJuSv+NKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030