UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0eJlk0exA59hkAPFfF4EjNWuMEJe1aP4Szs1byzivlo=' 
WHERE 
  key_id = 'ca56097ced12505e99128547d32a5608981d6b6145cc1d5f0afad7c155575273' 
  AND (
    token = '0eJlk0exA59hkAPFfF4EjNWuMEJe1aP4Szs1byzivlo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029