UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6xk41eUvbWY1+f37MRYmzqEyK07nkXso0srNgMDQhBM=' 
WHERE 
  key_id = 'f56274e41b0a2fdad94b35503166d3b0fb80dcf61f66b230f824f69861d4bfd9' 
  AND (
    token = '6xk41eUvbWY1+f37MRYmzqEyK07nkXso0srNgMDQhBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042