UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KKHDmvdGGwPwkAiba/QKPm3VwifRr8kTsyADHnTnU2U=' 
WHERE 
  key_id = 'cb1e32228a4c1911fbd59537510329dc3943d093c5cccf383a2e448295c5f6fd' 
  AND (
    token = 'KKHDmvdGGwPwkAiba/QKPm3VwifRr8kTsyADHnTnU2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048