UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dhAC4/IM+jtOZnW3ezzV7xTkat6uL/wFP7olvM3CeuM=' 
WHERE 
  key_id = '54ff49b338461f850285a2607c42abb8ec87e41cca0793d3ac6d0c121dbdbf0f' 
  AND (
    token = 'dhAC4/IM+jtOZnW3ezzV7xTkat6uL/wFP7olvM3CeuM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017