UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N03pTKxtCoQ0dcjnr5IUUFx6hN4T9SjVfmljWOl06LA=' 
WHERE 
  key_id = '41136ba2906505ec9961b30724e262ada70858e580e0693c3b5cf83b72e9786c' 
  AND (
    token = 'N03pTKxtCoQ0dcjnr5IUUFx6hN4T9SjVfmljWOl06LA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025