UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NUmN4fItjvpa5XjHdGqbJmCxxoZiVtYPoEib5+GhhCU=' 
WHERE 
  key_id = '12189f01e264fa1eaa75ea593a4ec5241c08794f21befdaeb7ae14501e3893d8' 
  AND (
    token = 'NUmN4fItjvpa5XjHdGqbJmCxxoZiVtYPoEib5+GhhCU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048