UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YWsBh5dXv+lwjOZJHGgrXhufU/szEXuqg3mhDCXGEuw=' 
WHERE 
  key_id = 'b8351ac97bef53a53bec03b1f2c44b9b9be755528bb0479f516e702318b7902b' 
  AND (
    token = 'YWsBh5dXv+lwjOZJHGgrXhufU/szEXuqg3mhDCXGEuw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035