UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WBLGLV/I+mAIyQlwJzqJsf0/8WYEAuSjoSnJmdoXNvU=' 
WHERE 
  key_id = '3404353a4033c32145a216940dc2f6b044618a161f7ecf0e1a09417cf5eac8d5' 
  AND (
    token = 'WBLGLV/I+mAIyQlwJzqJsf0/8WYEAuSjoSnJmdoXNvU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028