UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qnzGLeBgsRThD+PXExMc57lPA2q2yn8yswiTmx+uu6g=' 
WHERE 
  key_id = '8fa82944b1e1dc39d95b94ba159d8fec709aa07e76421518390e26f36f5609ef' 
  AND (
    token = 'qnzGLeBgsRThD+PXExMc57lPA2q2yn8yswiTmx+uu6g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026