UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XtaNk+K8xB5AHQ03Hib29VkpTfelSrMFCUr6HmTochY=' 
WHERE 
  key_id = '29d6d982328d932a12952539df0746a4089adb4fca7fac14e79d4f03b8f358af' 
  AND (
    token = 'XtaNk+K8xB5AHQ03Hib29VkpTfelSrMFCUr6HmTochY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017