UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0+HgFJ5tmyHQG6ZxAdCJYDDelfZFlurkS9ZJBeLbM5c=' 
WHERE 
  key_id = '00477c147f3b3ecd05ef7fa24a64b5c9921de044e7c0b7120d8eb288a2ee17c0' 
  AND (
    token = '0+HgFJ5tmyHQG6ZxAdCJYDDelfZFlurkS9ZJBeLbM5c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050