UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C+bChGYaIAejPU21XK/3stnzXPsUyBsTL5dFUk+mxk8=' 
WHERE 
  key_id = '70b0d864c1320d31a322807aca59cce912f266f44577f7a9040aa74d0dc308f4' 
  AND (
    token = 'C+bChGYaIAejPU21XK/3stnzXPsUyBsTL5dFUk+mxk8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017