UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v4gHtst+nQ7GRyFbVXDOVzzlv7qju8OB9VKICJ5PNN0=' 
WHERE 
  key_id = 'fb4336cf533ff9f88221922867afee7c18fcc470ccfcdafeab822893de75f318' 
  AND (
    token = 'v4gHtst+nQ7GRyFbVXDOVzzlv7qju8OB9VKICJ5PNN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021