UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+gKu4nhpKB9cKOqR8sIaYm9bzf6NJ6OMsAlUwFzdPXU=' 
WHERE 
  key_id = 'd6ec68da578ab43b1907f4ec62da8e3a5b0832c86f287e187d70595b8bdde24a' 
  AND (
    token = '+gKu4nhpKB9cKOqR8sIaYm9bzf6NJ6OMsAlUwFzdPXU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026