UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CHOcFQBeYzu8KHhy65zosX+YCdiw4bD2QEbc2EAZkio=' 
WHERE 
  key_id = 'a78e2176e68f8f1c9b3346834efe2af4f367825bc986b07a987bf2063c558207' 
  AND (
    token = 'CHOcFQBeYzu8KHhy65zosX+YCdiw4bD2QEbc2EAZkio=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036