UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TyGm+/VRuGxKOJ9JyGZV8ysZJwDPLLXN+6Lm6m+anU4=' 
WHERE 
  key_id = '95ddf29a8b87f663ff591a1294b2315069ffabe4913283f3b859e1e657ba0a1d' 
  AND (
    token = 'TyGm+/VRuGxKOJ9JyGZV8ysZJwDPLLXN+6Lm6m+anU4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047