UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CR9K/vc1N4cU5Dnlbqhfz9Zt+lRGfdCBkw3LqruTx8s=' 
WHERE 
  key_id = 'bda4500b0fb198195837a77ce137a04cd403fffa4f264a22a5f41d4b1db9375f' 
  AND (
    token = 'CR9K/vc1N4cU5Dnlbqhfz9Zt+lRGfdCBkw3LqruTx8s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047