UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pwjjntJV1CI+gVWimlkOOdLLbfDxt2C8tcsOLclzc7s=' 
WHERE 
  key_id = '49a69ad41d71be3bdf65a76906d05313470a5c4f9741d23e814c5f5786986e83' 
  AND (
    token = 'pwjjntJV1CI+gVWimlkOOdLLbfDxt2C8tcsOLclzc7s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038