UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c7VPSQfzB8oG72r9vkOGu4ZKIP0s193QkvwBhppDJ8k=' 
WHERE 
  key_id = '333f2d7b7299739d99ba868663ae3763974a05c8dbc00d05beaa2ea99e43930e' 
  AND (
    token = 'c7VPSQfzB8oG72r9vkOGu4ZKIP0s193QkvwBhppDJ8k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030