UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oU+QWTWRZ3CaAi1K0jc/Nqewq4j8bCAs0HYECKsZydc=' 
WHERE 
  key_id = '46f7520c2b353fb217f51a5e77cfcea571512dc58b01fa1a2a570d1705754595' 
  AND (
    token = 'oU+QWTWRZ3CaAi1K0jc/Nqewq4j8bCAs0HYECKsZydc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023